package bill.study.enums.effectivejava.item34;

import java.util.Arrays;
import java.util.Collection;

public class Tester {
	public static void main(String [] args){
		double x = 2.0;
		double y = 3.0;
		test1(ExtendedOperation.class, x, y);
		test2(Arrays.asList(ExtendedOperation.values()), x,y);
	}

	private static <T extends Enum<T> & Operation> void test1(Class<T> opSet, double x, double y){
		for(Operation op: opSet.getEnumConstants()){
			System.out.printf("%f %s %f = %f%n", x, op, y, op.apply(x, y));
		}
		
	}
	
	private static  void test2(Collection<? extends Operation> opSet, double x, double y){
		for(Operation op: opSet){
			System.out.printf("%f %s %f = %f%n", x, op, y, op.apply(x, y));
		}
		
	}
}
